﻿{extend name="public:base" /}{block name="css"}
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css"/>
<link rel="stylesheet" type="text/css" href="__ADMIN__/css/style.css">
<style>
    .select-box select {
        margin-right: 10px;
    }
</style>{/block}{block name="content"}

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox ">
                <div class="ibox-content">
                    <form method="post">
                        <div class="box-item">
                            <div class="form-group row"><label class="col-sm-1 col-form-label">头像</label>
                                <div class="col-sm-6">
                                    <div class="form-uploaded-box" id="form-uploaded-box-single" style="width: 140px">
                                        {if $info.avatar}
                                        <div class="form-uploaded-img-box">
                                            <img class="form-uploaded-box-img" src="{$info.avatar}" data-id="{$info.avatar}">
                                            <i class="form-uploaded-img-preview iconfont icon-yulan" onclick="previewImg(this, 'form-uploaded-img-preview')"></i>
                                        </div>
                                        {/if}
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>

                        <div class="box-item">
                            <div class="form-group row">
                                <label class="col-sm-1 col-form-label">昵称</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" name="username" placeholder="请输入昵称" value="{$info.username}">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>

                        <div class="box-item">
                            <div class="form-group row">
                                <label class="col-sm-1 col-form-label">手机号</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" name="mobile" placeholder="请输入手机号" value="{$info.mobile}" readonly>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>

                        <div class="box-item">
                            <div class="form-group row layui-form">
                                <label class="col-sm-1 col-form-label">账户类型</label>
                                <div class="col-sm-2">
                                    <input type="radio" lay-filter="account_type" name="account_type" value="1" title="支付宝" {$info.account_type!= 2 ? 'checked' : ''}>
                                    <input type="radio" lay-filter="account_type" name="account_type" value="2" title="银行卡" {$info.account_type ==2 ? 'checked' : ''}>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>

                        <div class="box-item alipay" style="display: none">
                            <div class="form-group row">
                                <label class="col-sm-1 col-form-label">支付宝姓名</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" name="alipay_name" placeholder="请输入支付宝姓名" value="{$info.alipay_name}">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>
                        <div class="box-item alipay" style="display: none">
                            <div class="form-group row">
                                <label class="col-sm-1 col-form-label">支付宝手机号</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" name="alipay_mobile" placeholder="请输入支付宝手机号" value="{$info.alipay_mobile}">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>
                        <div class="box-item bank" style="display: none">
                            <div class="form-group row">
                                <label class="col-sm-1 col-form-label">银行名称</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" name="bank_name" placeholder="请输入银行名称" value="{$info.bank_name}">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>
                        <div class="box-item bank" style="display: none">
                            <div class="form-group row">
                                <label class="col-sm-1 col-form-label">银行卡号</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" name="bank_num" placeholder="请输入银行卡号" value="{$info.bank_num}">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>
                        <div class="box-item bank" style="display: none">
                            <div class="form-group row">
                                <label class="col-sm-1 col-form-label">银行开户人姓名</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" name="bank_user" placeholder="请输入银行开户人姓名" value="{$info.bank_user}">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>
                        <div class="box-item">
                            <div class="form-group row layui-form">
                                <label class="col-sm-1 col-form-label">打卡状态</label>
                                <div class="col-sm-2">
                                    <input type="radio" name="clock_status" value="3" title="启用打卡" {$info.clock_status !=0 ? 'checked' : ''}>
                                    <input type="radio" name="clock_status" value="0" title="禁用打卡" {$info.clock_status == 0 ? 'checked' : ''}>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>
                        <div class="box-item">
                            <div class="form-group row layui-form">
                                <label class="col-sm-1 col-form-label">老客户</label>
                                <div class="col-sm-2">
                                    <input type="radio" name="is_vip" value="0" title="否" {$info.is_vip== 0 ? 'checked' : ''}>
                                    <input type="radio" name="is_vip" value="1" title="是" {$info.is_vip !=0 ? 'checked' : ''}>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>

                        <div class="box-item">
                            <div class="form-group row layui-form">
                                <label class="col-sm-1 col-form-label">复购</label>
                                <div class="col-sm-2">
                                    <input type="radio" name="is_repurchase" value="0" title="否" {$info.is_repurchase== 0 ? 'checked' : ''}>
                                    <input type="radio" name="is_repurchase" value="1" title="是" {$info.is_repurchase !=0 ? 'checked' : ''}>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>

                        <div class="box-item">
                            <div class="form-group row">
                                <label class="col-sm-1 col-form-label">复购描述</label>
                                <div class="col-sm-3">
                                    <textarea class="form-control" name="repurchase_desc" rows="8">{$info.repurchase_desc}</textarea>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>

                        <div class="form-group row">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button type="button" class="btn btn-w-m btn-default back-page">返回</button>
                                <button type="button" class="btn btn-w-m btn-primary ajax-post">提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

{include file="public/cropper-img-mask" cropper_uploaded_img_ids="cropper_uploaded_img_ids" cropper_uploaded_img_paths="cropper_uploaded_img_paths" crop_preview_box="crop-preview-box" /}{include file="public/preview-img-mask" swiper-id="cropper-preview" /}{/block}

{block name='js'}
<script src="__STATIC__/layui/layui.js"></script>
<script>

    var account_type = parseInt(`{$info.account_type}`)
    renderAccount(account_type)

    layui.use(['form', 'jquery'], function () {
        var form = layui.form;
        var $ = layui.jquery;

        // 监听类型选择
        form.on('radio(account_type)', function (data) {
            var account_type = parseInt(data.value);

            renderAccount(account_type)
            form.render(); // 刷新 layui 表单组件
        });
    });

    function renderAccount(account_type) {
        if (account_type == 2) {
            $('.alipay').hide();
            $('.bank').show();
        } else {
            $('.alipay').show();
            $('.bank').hide();
        }
    }
</script>{/block}

